home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / ChipCD 6.02.iso / macos / files / dragburn.sit / DragonBurn / Dragon Burn Installer / WebHelp / EHLPDHT1.JS < prev    next >
Text File  |  2002-01-09  |  45KB  |  1,570 lines

  1. //// Segment Begin -- (JavaScript 1.0)
  2. // eHelp« Corporation Dynamic HTML JavaScript 
  3. // Copyright⌐ 1998-2000 eHelp« Corporation.All rights reserved.
  4. // Version=4.42
  5.  
  6. // Warning:Do not modify this file.It is generated by RoboHELP« and changes will be overwritten.
  7.  
  8.  
  9. /// Section Begin - General (JavaScript 1.0)
  10.  
  11. //{{HH_SYMBOL_SECTION
  12. var HH_ChmFilename = "";
  13. var HH_WindowName = "";
  14. var HH_GlossaryFont = "";
  15. var HH_Glossary = "";
  16. var HH_Avenue = "";
  17. var HH_ActiveX = false;
  18. //}}HH_SYMBOL_SECTION
  19.  
  20. //Begin to support previous generic parameters
  21. //Get the information about the browser.
  22. var gstrBsAgent     = navigator.userAgent.toLowerCase();
  23. var gnBsVer               = parseInt(navigator.appVersion);
  24.  
  25. var gbBsIE          = (gstrBsAgent.indexOf('msie') != -1);
  26. var gbBsNS          = (gstrBsAgent.indexOf('mozilla') != -1) && ((gstrBsAgent.indexOf('spoofer') == -1) && (gstrBsAgent.indexOf('compatible') == -1));
  27. var gbBsOpera        = (gstrBsAgent.indexOf('opera') != -1);
  28.  
  29. var gbBsIE3Before     = ((gbBsIE) && (gnBsVer <= 2));
  30. var gbBsNS3Before     = ((gbBsNS) && (gnBsVer <= 3));
  31.  
  32. var gbBsNS2            = ((gbBsNS) && (gnBsVer <= 2));
  33. var gbBsNS3            = ((gbBsNS) && (gnBsVer == 3));
  34. var gbBsIE300301    = ((gbBsIE) && (gnBsVer == 2) && ((gstrBsAgent.indexOf("3.00") != -1)||(gstrBsAgent.indexOf("3.0a") != -1)||(gstrBsAgent.indexOf("3.0b")!=-1)||(gstrBsAgent.indexOf("3.01")!=-1)));
  35. var gbBsIE302        = ((gbBsIE) && (gnBsVer == 2) && (gstrBsAgent.indexOf("3.02") != -1));
  36.  
  37. var gbBsNS4            = ((gbBsNS) && (gnBsVer >= 4));
  38. var gbBsIE4            = ((gbBsIE) && (gnBsVer >= 4));
  39. var gbBsIE5            = ((gbBsIE) && (gnBsVer >= 5));
  40. var gbBsIE55        = false;
  41.  
  42. gbBsIE = (navigator.appName.indexOf("Microsoft") != -1);
  43. if (parseInt(navigator.appVersion) >= 4) {
  44.  
  45.     gbBsIE4 = (navigator.appName.indexOf("Microsoft") != -1);
  46.  
  47.     if (gbBsIE4) {
  48.         if (gstrBsAgent.indexOf("msie 5.0") != -1) {
  49.             gbBsIE5 = true;
  50.         }
  51.         if (gstrBsAgent.indexOf("msie 5.5") != -1) { // curently IE 5.5 has some buggy stuff. we need do some remedy to our code.
  52.             gbBsIE55 = true;
  53.         }
  54.     }
  55. }
  56.  
  57. var gbBsMac            = (gstrBsAgent.indexOf('mac') != -1);
  58. var gbBsWindows        = ((gstrBsAgent.indexOf('win') != -1) || (gstrBsAgent.indexOf('16bit') != -1));
  59. var gbBsOp3            = (gstrBsAgent.indexOf('opera') != -1);
  60.  
  61. // Utilities functions.
  62. function BsscHasExtJs()
  63. {
  64.     if( gbBsIE3Before || gbBsNS3Before)
  65.         return false;
  66.     return true;
  67. }
  68.  
  69. // Register event handler
  70. var gBsOnLoads             = new Array();    // An array holds all the onload event handler.
  71. var gBsOnClicks         = new Array();    // An array holds all the onClick event handler.
  72. var gBsOnUnLoads         = new Array();    // An array holds all the OnUnLoad event handler.
  73. var gBsOnMouseOvers     = new Array();    // An array holds all the OnMouseOver event handler.
  74. var gBsOnMouseOuts         = new Array();    // An array holds all the OnMouseOut event handler.
  75.  
  76. var gbOrignalOnMouseDown = null;
  77.  
  78. function BsscRegisterOnLoad(funcHandler)
  79. {
  80.     var nLength = gBsOnLoads.length;
  81.     gBsOnLoads[nLength] = funcHandler;
  82. }
  83.  
  84. function BsscRegisterOnClick(funcHandler)
  85. {
  86.     var nLength = gBsOnClicks.length;
  87.     gBsOnClicks[nLength] = funcHandler;
  88. }
  89.  
  90. function BsscRegisterOnUnLoad(funcHandler)
  91. {
  92.     var nLength = gBsOnUnLoads.length;
  93.     gBsOnUnLoads[nLength] = funcHandler;
  94. }
  95.  
  96. function BsscRegisterOnMouseOver(funcHandler)
  97. {
  98.     var nLength = gBsOnMouseOvers.length;
  99.     gBsOnMouseOvers[nLength] = funcHandler;
  100. }
  101.  
  102. function BsscRegisterOnMouseOut(funcHandler)
  103. {
  104.     var nLength = gBsOnMouseOuts.length;
  105.     gBsOnMouseOuts[nLength] = funcHandler;
  106. }
  107.  
  108.  
  109. function BsGeneralOnLoad()
  110. {
  111.     if (!gbBsIE4 && !gbBsNS4)
  112.         return;
  113.  
  114.     // Make everything visible in navigator
  115.     if (gbBsNS4) {
  116.         // Make some special effects items visible
  117.         for (var iLayer = 0; iLayer < document.layers.length; iLayer++) {
  118.             document.layers[iLayer].visibility = "show";
  119.             document.layers[iLayer].left = 0;
  120.         }
  121.     }
  122. }
  123.  
  124. // If resize the netscape browser, need to reload it.
  125. function BsReDo()
  126. {
  127.   if (innerWidth != origWidth || innerHeight != origHeight)
  128.      location.reload();
  129. }
  130. // End of the local functions.
  131.  
  132. // The following functions are used by the html files.
  133. function BSSCOnLoad()
  134. {
  135.     if( !BsscHasExtJs() )
  136.         return;
  137.     for (var nElement = gBsOnLoads.length - 1; nElement >= 0; nElement--)
  138.         gBsOnLoads[nElement]();
  139.     _BSSCCreatePopupDivOnLoad();// init for DHTML popups
  140. }
  141.  
  142. function BSSCOnClick()
  143. {
  144.     if (!BsscHasExtJs()) return;
  145.         
  146.     for (var nElement = gBsOnClicks.length - 1; nElement >= 0; nElement--)
  147.         gBsOnClicks[nElement]();
  148. }
  149.  
  150. function BSSCOnUnload()
  151. {
  152.     if (!BsscHasExtJs()) return;
  153.     for (var nElement = gBsOnUnLoads.length - 1; nElement >= 0; nElement--)
  154.     {
  155.         gBsOnUnLoads[nElement]();
  156.     }
  157. }
  158.  
  159. function BSSCOnMouseOver()
  160. {
  161.     if (!BsscHasExtJs()) return;
  162.     for (var nElement = gBsOnMouseOvers.length - 1; nElement >= 0; nElement--)
  163.     {
  164.         gBsOnMouseOvers[nElement]();
  165.     }
  166. }
  167.  
  168. function BSSCOnMouseOut()
  169. {
  170.     if (!BsscHasExtJs()) return;
  171.     for (var nElement = gBsOnMouseOuts.length - 1; nElement >= 0; nElement--)
  172.     {
  173.         gBsOnMouseOuts[nElement]();
  174.     }
  175. }
  176. // End of invocation of the event handle functions.
  177.  
  178.  
  179. // Add the GereralOnLoad to the onload array.
  180. if (typeof(BsscRegisterOnLoad) != "undefined")
  181. {
  182.     BsscRegisterOnLoad(BsGeneralOnLoad);
  183. }
  184.  
  185. if (gbBsNS4) {
  186.     origWidth = innerWidth;
  187.     origHeight = innerHeight;
  188.     onresize = BsReDo;
  189. }
  190. //End to support previous generic parameters
  191.  
  192. //Begin to support previous HHActiveX invoking
  193. function BsHHActivateComponents()
  194. {
  195.     if( HH_ActiveX && (HH_ChmFilename != "") && ((self == top) || (self == top.frames[0])))
  196.     {
  197.         var objBody = document.all.tags("BODY")[0];
  198.         if( typeof(objBody) == "object" )
  199.         {
  200.             objBody.insertAdjacentHTML("beforeEnd", '<OBJECT ID="HHComponentActivator" CLASSID="CLSID:399CB6C4-7312-11D2-B4D9-00105A0422DF" width=0 height=0></OBJECT>');
  201.             if (HHComponentActivator.object)
  202.                 HHComponentActivator.Activate(HH_ChmFilename, HH_WindowName, HH_GlossaryFont, HH_Glossary, HH_Avenue);
  203.         }
  204.     }
  205. }
  206.  
  207. function BsHHActivXOnLoad()
  208. {    
  209.     if( gbBsIE4 )
  210.         BsHHActivateComponents(); 
  211. }
  212.  
  213. if( typeof(BsscRegisterOnLoad) != "undefined" )
  214. {
  215.     BsscRegisterOnLoad(BsHHActivXOnLoad);
  216. }
  217. //End to support previous HHActiveX invoking
  218.  
  219.  
  220. /// Section End - General (JavaScript 1.0)
  221.  
  222. /// Section Begin  - Popup and Related Topic (JavaScript 1.0)
  223.  
  224. //Begin to support previous popup functions
  225. //////////////////////////////////////////////////////////////////////////////////////////////
  226. //
  227. //    Begin DHTML Popup Functions
  228. //
  229. //////////////////////////////////////////////////////////////////////////////////////////////
  230. //variables used to isolate the browser type
  231. var gBsDoc            = null;            
  232. var gBsSty            = null;
  233. var gBsHtm            = null;
  234. var gBsStyVisShow    = null;
  235. var gBsStyVisHide    = null;
  236. var gBsClientWidth    = 640;
  237. var gBsClientHeight = 480;
  238. var gBsBrowser        = null;
  239.  
  240. // here is the varible for judge popup windows size. these parameter is for IE5.0, it may need adjust for others.
  241. var gBRateH_W        = 0.618; // 1.618 Golden cut.
  242. var gBMaxXOfParent    = 0.8; 
  243. var gBMaxYOfParent    = 0.8;
  244. var gBscrollHeight   = 16;
  245. var gBscrollWidth   =  16;
  246. var gBpermitXDelta    = 3;
  247. var gBpermitYDelta    = 3;
  248.  
  249.  
  250. var g_bIsPopupInit = false;
  251. function _BSSCCreatePopupDivOnLoad()
  252. {
  253.     if(!g_bIsPopupInit)
  254.     {
  255.         BsPopup_CreateDiv(0);
  256.         g_bIsPopupInit = true;
  257.     }
  258. }
  259.  
  260. function _BSSCCreatePopupDivOnWrite()
  261. {
  262.     if(!g_bIsPopupInit)
  263.     {
  264.         BsPopup_CreateDiv(1);
  265.         g_bIsPopupInit = true;
  266.     }
  267. }
  268.  
  269. function _BSSCCreatePopupDivOnWriteForKodav()
  270. {
  271.     if(!g_bIsPopupInit)
  272.     {
  273.         if ((gbBsIE4) && (!gbBsIE5))
  274.         {
  275.             BsPopup_CreateDiv(2);
  276.             g_bIsPopupInit = true;
  277.         }
  278.     }
  279. }
  280.  
  281.  
  282. //the browser information itself
  283. function _BSPSBrowserItself()
  284. {
  285.     var agent  = navigator.userAgent.toLowerCase();
  286.     this.major = parseInt(navigator.appVersion);
  287.     this.minor = parseFloat(navigator.appVersion);
  288.     this.ns    = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
  289.     this.ns2   = ((this.ns) && (this.major == 2));
  290.     this.ns3   = ((this.ns) && (this.major == 3));
  291.     this.ns4   = ((this.ns) && (this.major >= 4));
  292.     this.ie       = (agent.indexOf("msie") != -1);
  293.     this.ie3   = ((this.ie) && (this.major == 2));
  294.     this.ie4   = ((this.ie) && (this.major >= 4));
  295.     this.op3   = (agent.indexOf("opera") != -1);
  296.  
  297.     if (this.ns4)
  298.     {
  299.         gBsDoc        = "document";
  300.         gBsSty        = "";
  301.         gBsHtm        = ".document";
  302.         gBsStyVisShow    = "show";
  303.         gBsStyVisHide    = "hide";
  304.  
  305.     }
  306.     else if (this.ie4)
  307.     {
  308.         gBsDoc         = "document.all";
  309.         gBsSty         = ".style";
  310.         gBsHtm         = "";
  311.         gBsStyVisShow    = "visible";
  312.         gBsStyVisHide    = "hidden";
  313.     }
  314. }
  315.  
  316. //Here is the browser type 
  317. function _BSPSGetBrowserInfo()
  318. {
  319.     gBsBrowser    = new _BSPSBrowserItself();
  320. }
  321.  
  322. //Get client size info
  323. function _BSPSGetClientSize()
  324. {
  325.     if (gBsBrowser.ns4)
  326.     {
  327.         gBsClientWidth    = innerWidth;
  328.         gBsClientHeight = innerHeight;
  329.  
  330.     }
  331.     else if (gBsBrowser.ie4)
  332.     {
  333.         gBsClientWidth    = document.body.clientWidth;
  334.         gBsClientHeight = document.body.clientHeight;
  335.     }
  336. }
  337.  
  338.  
  339. var gstrPopupID = 'BSSCPopup';
  340. var gstrPopupShadowID = 'BSSCPopupShadow';
  341. var gstrPopupTopicID = 'BSSCPopupTopic';
  342. var gstrPopupIFrameID = 'BSSCPopupIFrame';
  343. var gstrPopupIFrameName = 'BSSCPopupIFrameName';
  344.  
  345. var gstrPopupSecondWindowName = 'BSSCPopup';
  346.  
  347. var    gPopupDiv = null;
  348. var gPopupDivStyle = null;
  349. var    gPopupShadow = null;
  350. var    gPopupTopic = null;
  351. var gPopupIFrame = null;
  352. var gPopupIFrameStyle = null;
  353. var gPopupWindow = null;
  354. var gnPopupClickX = 0;
  355. var gnPopupClickY = 0;
  356.  
  357. var gnPopupScreenClickX = 0;
  358. var gnPopupScreenClickY = 0;
  359.  
  360. var gbPopupTimeoutExpired = false;
  361.  
  362. var gbScriptName = "EHELP_DHTM";
  363. var gbPathofJS = "";
  364.  
  365.  
  366. if (gbBsIE4) {
  367.     var aScripts = document.scripts;
  368.     var aScript = null;
  369.     var i = 0;
  370.     for (i = 0; i < aScripts.length ; i ++ )
  371.     {
  372.         if (aScripts[i].name == gbScriptName) {
  373.             aScript = aScripts[i];
  374.             break;
  375.         }
  376.         
  377.     }
  378.  
  379.     if (aScript != null) {
  380.         var nPathPos = 0;
  381.         var strCurrentSrc = "";
  382.         strCurrentSrc = aScript.src;
  383.         var nPathPos1 = strCurrentSrc.lastIndexOf("\\");
  384.         var nPathPos2 = strCurrentSrc.lastIndexOf("/");
  385.         if (nPathPos1 > nPathPos2)
  386.             nPathPos = nPathPos1 + 1;
  387.         else
  388.             nPathPos = nPathPos2 + 1;
  389.  
  390.         gbPathofJS = strCurrentSrc.substring(0, nPathPos);
  391.     }
  392. }
  393.  
  394. // Replace point - Used by SingleSource 
  395. // var gbBlankPageForIFrame = gbPathofJS + "_blank.htm";
  396.  var gbBlankPageForIFrame = gbPathofJS + "_blank.htm";
  397.  
  398. function DHTMLPopupSupport()
  399. {
  400.     if ((gbBsIE4) && (!gbBsMac)) {
  401.         return true;
  402.     }
  403.     return false;
  404. }
  405.  
  406.  
  407.  
  408. function BSSCPopup_IsPopup()
  409. {
  410.     if (DHTMLPopupSupport() && (this.name == gstrPopupIFrameName)) {
  411.         return true;
  412.     } else if ((gbBsNS4 || gbBsIE4) && (this.name == gstrPopupID)) {
  413.         return true;
  414.     } else {
  415.         return false;
  416.     }
  417. }
  418.  
  419.  
  420. // If there is a hyperlink in a popup window, display the hyperlink in
  421. // the original window.
  422. if (BSSCPopup_IsPopup()) {
  423.     document.write("<base target=\"_parent\">");
  424. }
  425.  
  426. // Local functions.
  427. function BsPopup_CreateDiv(mode)
  428. {
  429.     if( gPopupDiv != null || (!DHTMLPopupSupport()) )
  430.         return;
  431.     var strPopupDiv = "";
  432.     if (gbBsIE5 || gbBsIE55) {
  433.         strPopupDiv = "<DIV ID='" + gstrPopupID + "' STYLE='position:absolute; width:0; height:0; top:-100; left:0; z-index:600; visibility:hidden;'>";
  434.         strPopupDiv += "<DIV ID='" + gstrPopupShadowID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#C0C0C0;\"></DIV>";
  435.         strPopupDiv += "<DIV ID='" + gstrPopupTopicID + "' STYLE=\"position:absolute;top:0; left:0;  width:0; height:0; background-color:#FFFFFF;border:1px #000000 outset;\">";
  436.         strPopupDiv += "<IFRAME ID='" + gstrPopupIFrameID + "' name='" + gstrPopupIFrameName + "' src = '" + gbBlankPageForIFrame + "' frameborder=0 scrolling=auto></IFRAME>";
  437.         strPopupDiv += "</DIV></DIV>"; 
  438.     }
  439.     else {
  440.         strPopupDiv = "<DIV ID='" + gstrPopupID + "' STYLE='position:absolute; top:-100; left:0; z-index:600; visibility:hidden;'>";
  441.         strPopupDiv += "<DIV ID='" + gstrPopupShadowID + "' STYLE=\"position:absolute;top:0; left:0;  background-color:#C0C0C0;\"></DIV>";
  442.         strPopupDiv += "<DIV ID='" + gstrPopupTopicID + "' STYLE=\"position:absolute;top:0; left:0;  background-color:#FFFFFF;border:1px #000000 outset;\">";
  443.         strPopupDiv += "<IFRAME ID='" + gstrPopupIFrameID + "' name='" + gstrPopupIFrameName + "' src = '" + gbBlankPageForIFrame + "' frameborder=0 scrolling=auto></IFRAME>";
  444.         strPopupDiv += "</DIV></DIV>"; 
  445.     }
  446.         
  447.  
  448.     if (mode == 0)
  449.     {    
  450.         var objBody = document.all.tags("BODY")[0];
  451.         if( typeof(objBody) != "object" )
  452.             return;
  453.  
  454.         objBody.insertAdjacentHTML("beforeEnd", strPopupDiv);
  455.     }
  456.     else if (mode == 1)
  457.     {
  458.         document.write(strPopupDiv);
  459.     }
  460.     else if (mode == 2)
  461.     {
  462.         document.write(strPopupDiv);
  463.     }
  464. }
  465.  
  466.  
  467. function BSSCPopup_Timeout()
  468. {
  469.     if ((gPopupIFrame.document.readyState == "complete") &&
  470.         (gPopupIFrame.document.body != null) && 
  471.         (gPopupIFrame.location.href.indexOf("_blank.htm") == -1)) {
  472.         window.gPopupDivStyle.visibility = gBsStyVisShow;
  473.         BSSCPopup_TimeoutReal();
  474.     } else {
  475.         setTimeout("BSSCPopup_Timeout()", 100);
  476.     }
  477. }
  478.  
  479. function BSSCPopup_TimeoutReal()
  480. {
  481.     window.gbPopupTimeoutExpired = true;
  482.  
  483.     if (gPopupIFrame.document) {
  484.         BSSCPopup_ChangeTargettoParent(gPopupIFrame.document);
  485.         gPopupIFrame.document.body.onclick = BSSCPopupClicked;
  486.     }
  487.     gbOrignalOnMouseDown = document.onmousedown;
  488.     document.onmousedown = BSSCPopupParentClicked;
  489. }
  490.  
  491. function BSSCPopup_ChangeTargettoParent(tagsObject)
  492. {
  493.     var collA = tagsObject.all.tags("A");
  494.     var j = 0;
  495.     if (collA != null) {
  496.         for (j = 0; j < collA.length; j ++ )
  497.         {
  498.             collA[j].target = "_parent";
  499.         }
  500.  
  501.     }
  502. }
  503.  
  504. function BSPSPopupTopicWinHelp(strURL)
  505. {
  506.     _BSSCPopup(strURL);
  507.     return;
  508. }
  509.  
  510. function _BSSCPopup(strURL)
  511. {
  512.     if (DHTMLPopupSupport()) {
  513.         // If we are already in a popup, replace the contents
  514.         if (BSSCPopup_IsPopup()) {
  515.  
  516.             location.href = strURL;
  517.             parent.window.gbPopupTimeoutExpired = false;
  518.             if (gbBsMac) {
  519.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  520.             } else {
  521.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  522.             }
  523.             
  524.         } else {
  525.  
  526.             var tempColl = document.all.tags("DIV");
  527.             for (var iDiv = 0; iDiv < tempColl.length; iDiv++)
  528.             {
  529.                 if (tempColl(iDiv).id == gstrPopupID)
  530.                     gPopupDiv = tempColl(iDiv);
  531.                 if (tempColl(iDiv).id == gstrPopupShadowID)
  532.                     gPopupShadow = tempColl(iDiv);
  533.                 if (tempColl(iDiv).id == gstrPopupTopicID)
  534.                     gPopupTopic = tempColl(iDiv);
  535.             }
  536.         
  537.             gPopupIFrame = eval("gPopupDiv.document.frames['" + gstrPopupIFrameName + "']");
  538.             gPopupDivStyle = eval("gPopupDiv" + gBsSty);
  539.             gPopupIFrameStyle = eval(gBsDoc + "['" + gstrPopupIFrameName + "']" + gBsSty);
  540.  
  541.             // Load the requested URL into the IFRAME
  542.             gPopupIFrame.location.href = strURL;
  543.             window.gbPopupTimeoutExpired = false;
  544.             if (gbBsMac) {
  545.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 400);
  546.             } else {
  547.                 setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 100);
  548.             }
  549.         }
  550.  
  551.     } else {
  552.         _BSSCPopup2(strURL);
  553.     }
  554.     return;
  555. }
  556.  
  557.  
  558. function _BSSCPopup2(strURL)
  559. {
  560.     if (window.name == gstrPopupSecondWindowName) {
  561.         window.location = strURL;
  562.     } else {
  563.  
  564.         BSSCHidePopupWindow();
  565.         var nX = 0;
  566.         var nY = 0;
  567.         var nHeight = 300;
  568.         var nWidth = 400;
  569.         _BSPSGetClientSize();
  570.         if (gBsBrowser.ns4) {
  571.             nX = window.screenX + (window.outerWidth - window.innerWidth) + window.gnPopupClickX;
  572.             nY = window.screenY + (window.outerHeight - window.innerHeight) + window.gnPopupClickY;
  573.             if (nY + nHeight + 40 > screen.availHeight) {
  574.                 nY = screen.availHeight - nHeight - 40;
  575.             }
  576.             if (nX + nWidth + 40 > screen.availWidth) {
  577.                 nX = screen.availWidth - nWidth - 40;
  578.             }
  579.         } else {
  580.             nX = window.gnPopupScreenClickX;
  581.             nY = window.gnPopupScreenClickY;
  582.         }
  583.  
  584.         // Launch a separate window
  585.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
  586.         if (gBsBrowser.ns) {
  587.             strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth;
  588.             strParam += ",screenX=" + nX + ",screenY=" + nY;
  589.             strParam += ",dependent=yes";
  590.         }
  591.         else {
  592.             strParam += ",height=" + nHeight + ",width=" + nWidth;
  593.             strParam += ",left=" + nX + ",top=" + nY;
  594.         }
  595.         window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
  596.         if (gBsBrowser.ns4) {
  597.             window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
  598.             window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  599.             window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
  600.         }
  601.         else if (gBsBrowser.ie4)
  602.         {
  603.             window.gPopupWindow.focus();
  604.         }
  605.     }
  606.     return;
  607. }
  608.  
  609. function NonIEPopup_HandleBlur(e)
  610. {
  611.     window.gPopupWindow.focus();
  612. }
  613.  
  614. function NonIEPopup_HandleClick(e)
  615. {
  616.     // Because navigator will give the event to the handler before the hyperlink, let's
  617.     // first route the event to see if we are clicking on a Popup menu in a popup.
  618.     document.routeEvent(e);
  619.  
  620.     // If a popup menu is active then don't do anything with the click
  621.     if (window.gPopupWindow.gbInPopupMenu) {
  622.         window.gPopupWindow.captureEvents(Event.CLICK);
  623.         window.gPopupWindow.onclick = NonIEPopup_HandleClick;
  624.         return false;
  625.     }
  626.  
  627.     // Close the popup window
  628.     if (e.target.href != null) {
  629.         window.location.href = e.target.href;
  630.         if (e.target.href.indexOf("BSSCPopup") == -1) {
  631.             this.close();
  632.         }
  633.     } else {
  634.         this.close();
  635.     }
  636.     return false;
  637. }
  638.  
  639. function BSSCPopup_AfterLoad(strURL)
  640. {    
  641.     if (typeof(window.gPopupIFrame.document) == "unknown") {
  642.         _BSSCPopup2(strURL);
  643.         return;
  644.     }
  645.     if ((window.gPopupIFrame.document.readyState == "complete") &&
  646.         (window.gPopupIFrame.document.body != null) && 
  647.         (window.gPopupIFrame.location.href.indexOf("_blank.htm") == -1)) {
  648.         BSSCPopup_ResizeAfterLoad(strURL);
  649.     } else {
  650.         setTimeout("BSSCPopup_AfterLoad('" + strURL + "')", 200);
  651.     }
  652. }
  653.  
  654.  
  655. function BSSCPopup_ResizeAfterLoad(strURL)
  656. {
  657.     window.gPopupDivStyle.visibility = gBsStyVisHide;
  658.  
  659.     // Determine the width and height for the window
  660.     //var size = new BSSCSize(0, 0);
  661.     //BSSCGetContentSize(window.gPopupIFrame, size);
  662.     //var nWidth = size.x;
  663.     //var nHeight = size.y;
  664.  
  665.     _BSPSGetClientSize();
  666.     
  667.     var size = new BSSCSize(0, 0);
  668.  
  669.     BSSCGetContentSize(window.gPopupIFrame, size);
  670.  
  671.     // Determine the width and height for the window
  672.     var nWidth = size.x;
  673.     var nHeight = size.y;
  674.         
  675.     window.gPopupDivStyle.width = nWidth;
  676.     window.gPopupDivStyle.height = nHeight;
  677.  
  678.     // Determine the position of the window
  679.     var nClickX = window.gnPopupClickX;
  680.     var nClickY = window.gnPopupClickY;
  681.     var nTop = 0;
  682.     var nLeft = 0;
  683.  
  684.     if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) {
  685.         nTop = nClickY + 10;
  686.     } else {
  687.         nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20;
  688.     }
  689.     if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) {
  690.         nLeft = nClickX;
  691.     } else {
  692.         nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8;
  693.     }
  694.     
  695.     if (nTop < document.body.scrollTop ) nTop  = document.body.scrollTop + 1;
  696.     if (nLeft< document.body.scrollLeft) nLeft = document.body.scrollLeft + 1;
  697.  
  698.  
  699.     window.gPopupDivStyle.left = nLeft;
  700.     window.gPopupDivStyle.top = nTop;
  701.  
  702.     // Set the location of the background blocks
  703.     window.gPopupShadow.style.left = 6;
  704.     window.gPopupShadow.style.top = 6;
  705.     if (gbBsIE55)
  706.     {
  707.         window.gPopupShadow.style.left = 4;
  708.         window.gPopupShadow.style.top = 4;
  709.     }
  710.     window.gPopupShadow.style.width = nWidth;
  711.     window.gPopupShadow.style.height = nHeight;
  712.     window.gPopupTopic.style.width = nWidth;
  713.     window.gPopupTopic.style.height = nHeight;
  714.     if (gbBsIE55)
  715.     {
  716.         window.gPopupShadow.style.width = nWidth + 2;
  717.         window.gPopupShadow.style.height = nHeight + 2;
  718.         window.gPopupTopic.style.width = nWidth + 2;
  719.         window.gPopupTopic.style.height = nHeight + 2;
  720.     }
  721.  
  722.  
  723.     if (gbBsMac) {
  724.         // Total hack on the iMac to get the IFrame to position properly
  725.         window.gPopupIFrameStyle.pixelLeft = 100;
  726.         window.gPopupIFrameStyle.pixelLeft = 0;
  727.         // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it
  728.         window.gPopupIFrame.window.BSSCOnLoad();
  729.     }
  730.     //var nOriWidth = window.gPopupIFrameStyle.width
  731.  
  732.     window.gPopupIFrameStyle.width = nWidth;
  733.     window.gPopupIFrameStyle.height = nHeight;
  734.     if (gbBsIE55)
  735.     {
  736.         window.gPopupIFrameStyle.top = 0;
  737.         window.gPopupIFrameStyle.left = 0;
  738.     }
  739.  
  740.     gPopupIFrame.location.href = strURL;  // reload again, this will fix the bookmark misunderstand in IE5.
  741.     
  742.     setTimeout("BSSCPopup_Timeout();", 100);
  743.     
  744.     return false;
  745. }
  746.  
  747. function    BSSCSize(x, y)
  748. {
  749.     this.x = x;
  750.     this.y = y;
  751. }
  752.  
  753. function BSSCGetContentSize(thisWindow, size)
  754. {
  755.     if (!((gBsBrowser.ie4) || (gBsBrowser.ns4)))
  756.         return;
  757.  
  758.     if (gbBsMac) {
  759.         size.x = 300;
  760.         size.y = 300;
  761.         return;
  762.     }
  763.  
  764.     // Resize the width until it is wide enough to handle the content
  765.     // The trick is to start wide and determine when the scrollHeight changes
  766.     // because then we know a scrollbar is necessary. We can then go back
  767.     // to the next widest size (for no scrollbar)
  768.  
  769.     var ClientRate = gBsClientHeight / gBsClientWidth;
  770.  
  771.     var GoldenSize = new BSSCSize(0,0);
  772.     GoldenSize.x = gBsClientWidth * gBMaxXOfParent;
  773.     GoldenSize.y = gBsClientHeight *gBMaxYOfParent ;
  774.  
  775.     if (ClientRate > gBRateH_W) {
  776.         GoldenSize.y = GoldenSize.x * gBRateH_W;
  777.     }
  778.     else {
  779.         GoldenSize.x = GoldenSize.y / gBRateH_W;
  780.     }
  781.  
  782.     // Try to using parent specified max x.
  783.     var x = 0;
  784.     var maxgoldx = GoldenSize.x;
  785.     var maxx = gBsClientWidth * gBMaxXOfParent;
  786.     
  787.     // This double resize causes the document to re-render (and we need it to)
  788.     thisWindow.moveTo(10000,10000); // this is used to fix the flash on IE4.
  789.     thisWindow.resizeTo(1, 1);
  790.     thisWindow.resizeTo(1, 1);
  791.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  792.     thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight);
  793.         
  794.     var miny = thisWindow.document.body.scrollHeight + gBscrollHeight;
  795.     
  796.     if (miny > GoldenSize.y) // the popup does not fix in the parent wanted golden area. so try to expand itself as large as it can
  797.     {
  798.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  799.         thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight);
  800.         
  801.         miny =     thisWindow.document.body.scrollHeight + gBscrollHeight;
  802.         maxy = gBsClientHeight * gBMaxYOfParent;
  803.         
  804.         if (miny > maxy) { // the popup must have a scroll, OK let it be.
  805.             miny = maxy;
  806.             size.x = maxx;
  807.             size.y = maxy;
  808.         }
  809.         else { // popup still can fit in the parent area by someway. now we choose the same h/w rate as parent.
  810.             size.y = miny;
  811.             
  812.             //  downsize from maxx , now I try to using binary divide.
  813.             x = maxx;
  814.             deltax = -maxx/2;
  815.             //j = 0;
  816.             while (true) {
  817.                 x = x + deltax;
  818.                 thisWindow.resizeTo(x, miny);
  819.                 thisWindow.resizeTo(x, miny);
  820.                 diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * ClientRate;
  821.                 if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  822.                     deltax = Math.abs(deltax) /2;
  823.                 else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  824.                     deltax = -Math.abs(deltax) /2;
  825.                 else 
  826.                     // the y is close enough to wanted.
  827.                     break;
  828.                 if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  829.                     break;
  830.             }
  831.             size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth;
  832.             size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight;    
  833.             thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  834.             
  835.         // Handle absurd cases just in case IE flakes
  836.     //        if (size.y < 100) {
  837.     //            size.y = 100;
  838.     //        }
  839.         }
  840.     }
  841.     else {
  842.         //  downsize from maxgoldx , now I try to using binary divide.
  843.         x = maxgoldx;
  844.         deltax = -maxgoldx/2;
  845.         //i = 0;
  846.         while (true) {
  847.             x = x + deltax;
  848.             thisWindow.resizeTo(x, miny);
  849.             thisWindow.resizeTo(x, miny);
  850.             diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * gBRateH_W;
  851.             if (diffy >  gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter
  852.                 deltax = Math.abs(deltax) /2;
  853.             else if (diffy <  -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter
  854.                 deltax = -Math.abs(deltax) /2;
  855.             else 
  856.                 // the y is close enough to wanted.
  857.                 break;
  858.             if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore.
  859.                 break;
  860.             //i ++;
  861.                 
  862.         }
  863.         size.x = thisWindow.document.body.scrollWidth ;//+ gBscrollWidth;
  864.         size.y = thisWindow.document.body.scrollHeight ;//+ gBscrollHeight;    
  865.         thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little.
  866.     }
  867.  
  868.     size.x = size.x + 16;    //reserve a width for scrollbar
  869.  
  870.     thisWindow.resizeTo(size.x, size.y);
  871.     thisWindow.resizeTo(size.x, size.y);
  872.     return;
  873. }
  874.  
  875.  
  876.  
  877. function BSSCPopupParentClicked()
  878. {
  879.     BSSCPopupClicked();
  880.     return;
  881. }
  882.  
  883.  
  884. function BSSCPopupClicked()
  885. {
  886.     if (!window.gbPopupTimeoutExpired) {
  887.         return false;
  888.     }
  889.  
  890.     if (gPopupIFrame.window.gbInPopupMenu) {
  891.         return false;
  892.     }
  893.  
  894.     // Give the user a message about javascript calls through objects.
  895.     if ((gPopupIFrame.window.event != null) &&
  896.         (gPopupIFrame.window.event.srcElement != null) &&
  897.         (gPopupIFrame.window.event.srcElement.tagName == "A") &&
  898.         (gPopupIFrame.window.event.srcElement.href.indexOf("javascript:") == 0) &&
  899.         (gPopupIFrame.window.event.srcElement.href.indexOf(".") != -1)) {
  900.         gPopupIFrame.window.event.cancelBubble = true;
  901.         alert('Hyperlinks to objects do not work in popups.');
  902.         return false;
  903.     }
  904.  
  905.     if (gPopupIFrame.document) {
  906.         gPopupIFrame.document.body.onclick = null;
  907.     }
  908.  
  909.     document.onmousedown = gbOrignalOnMouseDown;
  910.  
  911.     // Simply hide the popup
  912.     gPopupDivStyle.visibility = gBsStyVisHide;
  913.     gPopupIFrame.location.href = gbBlankPageForIFrame;
  914.  
  915.     return true;
  916. }
  917.  
  918.  
  919. //trace the mouse over's position for hotspot
  920. function  BSPSPopupOnMouseOver(event)
  921. {
  922.     if (gBsBrowser.ie4) {
  923.         window.gnPopupClickX = event.clientX + document.body.scrollLeft;
  924.         window.gnPopupClickY = event.clientY + document.body.scrollTop;
  925.         window.gnPopupScreenClickX = event.screenX;
  926.         window.gnPopupScreenClickY = event.screenY;
  927.     } else if (gBsBrowser.ns4) {
  928.         window.gnPopupClickX = event.pageX;
  929.         window.gnPopupClickY = event.pageY;
  930.     }
  931. }
  932.  
  933. function BSSCHidePopupWindow()
  934. {
  935.     if (window.gPopupWindow != null) {
  936.         if (gBsBrowser.ns4) {
  937.             if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) {
  938.                 window.gPopupWindow.close();
  939.                 window.gPopupWindow = null;
  940.             }
  941.         }
  942.     }
  943.  
  944.     return;
  945. }
  946.  
  947. // Add the PopupOnClick to the onclick array.
  948. if (typeof(BsscRegisterOnClick) != "undefined")
  949. {
  950.     BsscRegisterOnClick(BsPopupOnClick);
  951. }
  952. //End to support previous popup functions
  953.  
  954. //Begin to support previous relative topics
  955. //If webHelp needs Related Topics DHTMLcode, it's supposed to add it here
  956. var gbPopupMenuTimeoutExpired = false;
  957. var gbInPopupMenu = false;
  958. var gbPopupMenuTopicList = null;
  959.  
  960. //////////////////////////////////////////////////////////////////////////////////////////
  961. //
  962. // Popup Menu code
  963. //
  964. //////////////////////////////////////////////////////////////////////////////////////////
  965.  
  966. var g_bIsPopupMenuInit = false;
  967. function _WritePopupMenuLayer()
  968. {
  969.     if (!g_bIsPopupMenuInit)
  970.         {
  971.       if (gbBsNS4) {
  972. //Do not try to write ininle styles for NS!  NS can not handle it and will not stop downloading the html page...
  973.        document.write("<DIV CLASS='WebHelpPopupMenu' ID='PopupMenu'></DIV>");
  974.       } else{
  975.       document.write("<DIV ID='PopupMenu' STYLE='position:absolute; left:0px; top:0px; z-index:4; visibility:hidden;'></DIV>");
  976.       if (gbBsIE4) {
  977.         document.write("<STYLE TYPE='text/css'>");
  978.         if (gbBsMac) {
  979.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:10pt; text-decoration:none;}");
  980.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:10pt; text-decoration:none;}");
  981.         } else {
  982.             document.write(".PopupOver {font-family:'Arial'; color:white; background:navy; font-size:8pt; text-decoration:none;}");
  983.             document.write(".PopupNotOver {font-family:'Arial'; color:black; background:#c0c0c0; font-size:8pt; text-decoration:none;}");
  984.         }
  985.         document.write("</STYLE>");
  986.        }
  987.           }
  988.       g_bIsPopupMenuInit = true;
  989.     }
  990. }
  991.  
  992. //Define variable arguments as: strTitle, strUrl
  993. function PopupMenuTopicEntry() 
  994. {
  995.     this.strTitle = PopupMenuTopicEntry.arguments[0];
  996.     this.strURL = PopupMenuTopicEntry.arguments[1];
  997. }
  998.  
  999. // If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js)
  1000. function PopupMenu_SetTopicList(aPopupTopicArray)
  1001. {
  1002.     gbPopupMenuTopicList = aPopupTopicArray;
  1003. }
  1004.  
  1005. //Seek for the bsscright frame 
  1006. function _SeekFrameByName( cRoot, strName )
  1007. {
  1008.     if( cRoot == null )    return null;
  1009.     if( cRoot.frames == null )    return null;
  1010.     if( cRoot.frames[strName] != null )    return cRoot.frames[strName];
  1011.     for (var i=0; i<cRoot.frames.length; i++)
  1012.     {
  1013.         var cObj = _SeekFrameByName( cRoot.frames(i).document, strName );
  1014.         if( cObj != null )        return cObj;
  1015.     };
  1016.     return null;
  1017. }
  1018. function _GetFrameByName( cRoot, strName )
  1019. {
  1020.     if( cRoot == null )    return null;
  1021.     var cRet = _SeekFrameByName(cRoot, strName);
  1022.     if( cRet != null )    return cRet;
  1023.     return _GetFrameByName( cRoot.parent, strName );
  1024. }
  1025.  
  1026. function _PopupMenu_Invoke(fn_arguments)
  1027. {
  1028.     if ((!gbBsIE4 && !gbBsNS4) || ((gbBsMac) && (gbBsIE4) && (window.event.srcElement.tagName == "AREA"))) {
  1029.     
  1030.         var argLen     = fn_arguments.length;
  1031.  
  1032.         // Create the window that the hyperlinks will go into
  1033.         var nHeight = argLen * 15;
  1034.         var nWidth = 400;
  1035.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1036.         strParam += ",height=" + nHeight + ",width=200";
  1037.         strParam += ",resizable";
  1038.  
  1039.         // Create a temporary window first to ensure the real popup comes up on top
  1040.         var wndTemp = window.open("", "temp", strParam);
  1041.  
  1042.         // Create the real popup window
  1043.         var wndPopupLinks = window.open("", "popuplinks", strParam);
  1044.  
  1045.         // Close the temporary
  1046.         wndTemp.close();
  1047.  
  1048.         wndPopupLinks.document.open("text/html");
  1049.         wndPopupLinks.document.write("<html><head></head>");
  1050.         wndPopupLinks.document.write("<body onBlur=\'self.focus();\'>");
  1051.         var strParaLine = "";
  1052.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1053.             strParaLine = "";
  1054.             strParaLine += "<a href=\"javascript:";
  1055.             if (gbBsIE) {
  1056.                 strParaLine += "onBlur=null; ";
  1057.             }
  1058.             strParaLine += "opener.location=\'";
  1059.             strParaLine += fn_arguments[2 * i + 3];
  1060.             strParaLine += "\';close();\"";
  1061.             if (fn_arguments[1] != '') {
  1062.                 strParaLine += " TARGET='" + fn_arguments[1] + "'";
  1063.             }
  1064.             strParaLine += ">";
  1065.             strParaLine += fn_arguments[2 * i + 2];
  1066.             strParaLine += "</a>";
  1067.             strParaLine += "<br>";
  1068.             wndPopupLinks.document.write(strParaLine);
  1069.         }
  1070.         wndPopupLinks.document.write("</body></html>");
  1071.         wndPopupLinks.document.close();
  1072.         window.gbInPopupMenu = true;
  1073.         if (!gbBsIE) {
  1074.             wndPopupLinks.focus();
  1075.         }
  1076.  
  1077.         return false;
  1078.     }
  1079.  
  1080.     // Make sure we have reasonable arguments
  1081.     var argLen = fn_arguments.length;
  1082.     if (argLen < 3) {
  1083.         return false;
  1084.     }
  1085.  
  1086.     // Check to see if we only have one target
  1087.     var strTarget = "";
  1088.     if (((argLen < 5) && ((isNaN(fn_arguments[2])) || (gbPopupMenuTopicList == null))) ||
  1089.         ((argLen < 4) && ((!isNaN(fn_arguments[2])) && (gbPopupMenuTopicList != null)))) {
  1090.  
  1091.         // Get the place that we will be putting the topic into
  1092.         var targetDoc = null;
  1093.         if (fn_arguments[1] == '') {
  1094.             targetDoc = window.document;
  1095.         } else {
  1096.             targetDoc = _GetFrameByName( parent, fn_arguments[1] );
  1097.             if (targetDoc == null) {
  1098.                 targetDoc  = window.document;
  1099.             }
  1100.             //if (gbBsIE4) {
  1101.             //        targetDoc = eval("top.document.frames['" + fn_arguments[1] + "']");
  1102.             //    } else if (gbBsNS4) {
  1103.             //    targetDoc = eval("window.top." + fn_arguments[1] + ".document");
  1104.             //}
  1105.             strTarget = "TARGET='" + fn_arguments[1] + "'";
  1106.         }
  1107.         if (isNaN(fn_arguments[2]) ||  (gbPopupMenuTopicList == null)) {
  1108.             targetDoc.location.href = fn_arguments[3];
  1109.         } else {
  1110.             targetDoc.location.href = gbPopupMenuTopicList[fn_arguments[2]].strURL;
  1111.         }
  1112.         return false;
  1113.     }
  1114.     
  1115.     var strMenu = "";
  1116.     if (gbBsNS4) {
  1117.         strMenu = '<TABLE BORDER="1" CELLSPACING=0 CELLPADDING=3 BGCOLOR="#c0c0c0">';
  1118.     } else {
  1119.         strMenu = '<TABLE STYLE="border:2px outset white;" CELLSPACING=0';
  1120.         if (gbBsMac) {
  1121.             strMenu += ' CELLPADDING=4';
  1122.         } else {
  1123.             strMenu += ' CELLPADDING=2';
  1124.         }    
  1125.         strMenu += ' BGCOLOR=#c0c0c0>';
  1126.     }
  1127.  
  1128.     // Add each of the items
  1129.     var i = 2;
  1130.     while (i <= argLen - 1) {
  1131.         strMenu += '<TR><TD><NOBR>'
  1132.         // If the destination is a number then look it up in the topic list
  1133.         if (isNaN(fn_arguments[i]) ||  (gbPopupMenuTopicList == null)) {
  1134.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + fn_arguments[i + 1] + '"' + strTarget;
  1135.         } else {
  1136.             strMenu += '<DIV STYLE="padding-left:3pt; padding-right:3pt;"><A HREF="' + gbPopupMenuTopicList[fn_arguments[i]].strURL + '"' + strTarget;
  1137.         }
  1138.         strMenu += ' onclick="PopupMenu_HandleClick(event);"';
  1139.         strMenu += ' onmouseover="PopupMenu_Over(event);"';
  1140.         strMenu += ' onmouseout="PopupMenu_Out(event);"';
  1141.         strMenu += '>';
  1142.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1143.             strMenu += '<SPAN CLASS="PopupNotOver">' + fn_arguments[i] + '</SPAN>';
  1144.         } else {
  1145.             strMenu += '<SPAN CLASS="PopupNotOver">' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + '</SPAN>';
  1146.         }
  1147.         strMenu += '</A></DIV></NOBR></TD></TR>';
  1148.  
  1149.         if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) {
  1150.             i += 2;
  1151.         } else {
  1152.             i += 1;
  1153.         }
  1154.     }
  1155.     strMenu += "</TABLE>";
  1156.  
  1157.     if (gbBsMac) {
  1158.     // totally hack. because ie5 in mac need something. </TABLE> is one of them. mac is mad.
  1159.         strMenu +="<TABLE></TABLE>";
  1160.     }
  1161.  
  1162.     var layerPopup = null;
  1163.     var stylePopup = null;
  1164.     var nEventX = 0;
  1165.     var nEventY = 0;
  1166.     var nWindowWidth = 0;
  1167.     if (gbBsIE4) {
  1168.  
  1169.         layerPopup = document.all["PopupMenu"];
  1170.         layerPopup.innerHTML = strMenu;
  1171.         stylePopup = layerPopup.style;
  1172.  
  1173.         _BSPSGetClientSize();
  1174.  
  1175.         // Get the position of the item causing the event (relative to its parent)
  1176.         //if (gbBsMac) {
  1177.         if (true) {
  1178.             nEventX = window.event.clientX;
  1179.             nEventY = window.event.clientY;
  1180.         } else {
  1181.             //??? YJ: Can not remember why we calculate envent position by following code...
  1182.             //but it is wrong in a case like: CENTER->P->TABLE:
  1183.             //the offset positions of TABLE, P and CENTER are same (same offsetTop,offsetLeft)
  1184.             //so we get triple times of offset of x and y as we expect... 
  1185.  
  1186.             nEventX = window.event.srcElement.offsetLeft - document.body.scrollLeft;
  1187.             nEventY = window.event.srcElement.offsetTop - document.body.scrollTop;
  1188.  
  1189.             // Get the location of the parent
  1190.             var nParentLocX = 0;
  1191.             var nParentLocY = 0;
  1192.  
  1193.             var ParentItem = window.event.srcElement.offsetParent;
  1194.             while (ParentItem != null) {
  1195.                 if (ParentItem.offsetLeft)    {
  1196.                     nParentLocX += ParentItem.offsetLeft;
  1197.                     nParentLocY += ParentItem.offsetTop;
  1198.                 }
  1199.                 ParentItem = ParentItem.parentElement;
  1200.             }
  1201.  
  1202.             // Adjust the location of the item using the location of the parent(s)
  1203.             nEventX += nParentLocX;
  1204.             nEventY += nParentLocY;
  1205.         }
  1206.  
  1207.         if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) {
  1208.             nEventY += document.body.scrollTop + 10;
  1209.         } else {
  1210.             nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20;
  1211.         }
  1212.         stylePopup.top = nEventY;
  1213.  
  1214.         if (nEventX + layerPopup.scrollWidth + 20 > gBsClientWidth) {
  1215.             if (gBsClientWidth - layerPopup.scrollWidth < 5) {
  1216.                 stylePopup.left = 5;
  1217.             } else {
  1218.                 stylePopup.left = gBsClientWidth - layerPopup.scrollWidth - 5;
  1219.             }
  1220.         } else {
  1221.             stylePopup.left = nEventX + document.body.scrollLeft + 20;
  1222.         }
  1223.  
  1224.         stylePopup.visibility = "visible";
  1225.         document.onclick = PopupMenu_HandleClick;
  1226.     } else if (gbBsNS4) {
  1227.         layerPopup = document.layers.PopupMenu;
  1228.         layerPopup.visibility = "hide";
  1229.         stylePopup = layerPopup.document;
  1230.         stylePopup.write(strMenu);
  1231.         stylePopup.close();
  1232.         var e = fn_arguments[0];
  1233.         nEventX = e.pageX;
  1234.         nEventY = e.pageY;
  1235.         _BSPSGetClientSize();
  1236.         if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) {
  1237.             nEventY += 20;
  1238.         } else {
  1239.             nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20;
  1240.         }
  1241.         layerPopup.top = nEventY;
  1242.  
  1243.         if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) {
  1244.             if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) {
  1245.                 nEventX = 5;
  1246.             } else {
  1247.                 nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20;
  1248.             }
  1249.         } else {
  1250.             nEventX += 20;
  1251.         }
  1252.  
  1253.         layerPopup.left = nEventX;
  1254.  
  1255.         layerPopup.visibility = "show";
  1256.  
  1257. //        window.captureEvents(Event.CLICK | Event.MOUSEDOWN);
  1258.         window.captureEvents(Event.MOUSEDOWN);
  1259. //        window.onclick = PopupMenu_HandleClick;
  1260.         window.onmousedown = PopupMenu_HandleClick;
  1261.     }
  1262.  
  1263.     window.gbInPopupMenu = true;
  1264.     window.gbPopupMenuTimeoutExpired = false;
  1265.     setTimeout("PopupMenu_Timeout();", 100);
  1266.     return false;
  1267. }
  1268.  
  1269.  
  1270. function PopupMenu_Timeout()
  1271. {
  1272.     window.gbPopupMenuTimeoutExpired = true;
  1273. }
  1274.  
  1275. function PopupMenu_Over(e)
  1276. {
  1277.     if (gbBsIE4) {
  1278.         e.srcElement.className = "PopupOver";
  1279.     } else if (gbBsNS4) {
  1280. //        this.bgColor = "red";
  1281. //        e.target.document.className = "PopupOver";
  1282.     }
  1283.     return;
  1284. }
  1285.  
  1286. function PopupMenu_Out(e)
  1287. {
  1288.     if (gbBsIE4) {
  1289.         e.srcElement.className = "PopupNotOver";
  1290.     } else if (gbBsNS4) {
  1291.         this.bgColor = "#f0f0f0";
  1292.     }
  1293.     return;
  1294. }
  1295.  
  1296.  
  1297. function PopupMenu_HandleClick(e)
  1298. {
  1299.     if (!window.gbPopupMenuTimeoutExpired) {
  1300.         return;
  1301.     }
  1302.  
  1303.     window.gbInPopupMenu = false;
  1304.  
  1305.     if (gbBsNS4) {
  1306. //        window.releaseEvents(Event.CLICK);
  1307.         window.releaseEvents(Event.MOUSEDOWN);
  1308.     }
  1309.  
  1310.     var layerPopup = null;
  1311.     var stylePopup = null;
  1312.     if (gbBsIE4) {
  1313.         layerPopup = document.all["PopupMenu"];
  1314.         stylePopup = layerPopup.style;
  1315.         stylePopup.visibility = "hidden";
  1316.     } else if (gbBsNS4) {
  1317.         layerPopup = document.layers.PopupMenu;
  1318.         layerPopup.visibility = "hide";
  1319.     }
  1320.  
  1321.     return;
  1322. }
  1323.  
  1324. // This function should be deleted when all old projects are cleaned up
  1325. function BSPSWritePopupFrameForIE4()
  1326. {
  1327.     return false;
  1328. }
  1329.  
  1330. /////////////////////////////////////////////////////////////////////
  1331. function BSSCPopup_ClickMac()
  1332. {
  1333.     if ((!DHTMLPopupSupport()) && (gbBsIE4))
  1334.     {    
  1335.         var bClickOnAnchor = false;
  1336.         var el;
  1337.         if ((window.event != null) &&
  1338.             (window.event.srcElement != null))
  1339.         {
  1340.             el = window.event.srcElement;
  1341.             while (el != null)
  1342.             {
  1343.                 if ((el.tagName == "A") || (el.tagName == "AREA"))     {
  1344.                     bClickOnAnchor = true;
  1345.                     break;
  1346.                 }
  1347.                 if (el.tagName == "BODY") {
  1348.                     break;
  1349.                 }
  1350.                 el = el.parentElement;
  1351.             }
  1352.         }
  1353.         if (BSSCPopup_IsPopup())
  1354.         {
  1355.             if (!bClickOnAnchor) {
  1356.                 parent.window.gPopupWindow = null;
  1357.                 self.close();
  1358.             }
  1359.         }
  1360.         else
  1361.         {
  1362.             bClosePopupWindow = true;
  1363.             if ((bClickOnAnchor) &&
  1364.                 (el.href) &&
  1365.                 (el.href.indexOf("javascript:BSSCPopup") != -1))
  1366.             {
  1367.                 bClosePopupWindow = false;
  1368.             }
  1369.             if (bClosePopupWindow)
  1370.             {
  1371.                 if (window.gPopupWindow != null)
  1372.                 {
  1373.                     var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400";
  1374.                     window.gPopupWindow = window.open("", gstrPopupSecondWindowName,strParam);
  1375.                     window.gPopupWindow.close();
  1376.                     window.gPopupWindow = null;
  1377.                 }
  1378.             }
  1379.         }
  1380.     }
  1381.  }
  1382.  
  1383. //////////////////////////////////////////////////////////////////////
  1384.  
  1385. _BSPSGetBrowserInfo();
  1386.  
  1387.  
  1388. function BsPopupOnClick()
  1389. {
  1390.     if (!gbBsIE4)
  1391.         return;
  1392.  
  1393.     BSSCPopup_ClickMac();
  1394. }
  1395.  
  1396. function _BSSCOnError(message)
  1397. {
  1398.     if(-1 != message.indexOf("denied") 
  1399.         || -1 != message.indexOf("Object required"))
  1400.      return true;
  1401. }
  1402.  
  1403. //End to support previous relative topics
  1404.  
  1405. /// Section End  - Popup and Related Topic (JavaScript 1.0)
  1406.  
  1407. /// Section Begin - Embedded Stub (JavaScript 1.0)
  1408.  
  1409. var s_strAgent = navigator.userAgent.toLowerCase();
  1410. var s_nVer       = parseInt(navigator.appVersion);
  1411.  
  1412. var s_bIE  = (s_strAgent.indexOf('msie') != -1);
  1413. var s_bNS  = (s_strAgent.indexOf('mozilla') != -1) && ((s_strAgent.indexOf('spoofer') == -1) && (s_strAgent.indexOf('compatible') == -1));
  1414. var s_bOpera    = (s_strAgent.indexOf('opera') != -1);
  1415.  
  1416. var s_bIE3Before = ((s_bIE) && (s_nVer <= 2));
  1417. var s_bNS3Before = ((s_bNS) && (s_nVer <= 3));
  1418.  
  1419. var s_bNS2        = ((s_bNS) && (s_nVer <= 2));
  1420. var s_bNS3        = ((s_bNS) && (s_nVer == 3));
  1421. var s_bIE300301    = ((s_bIE) && (s_nVer == 2) && ((s_strAgent.indexOf("3.00") != -1)||(s_strAgent.indexOf("3.0a") != -1)||(s_strAgent.indexOf("3.0b")!=-1)||(s_strAgent.indexOf("3.01")!=-1)));
  1422. var s_bIE302    = ((s_bIE) && (s_nVer == 2) && (s_strAgent.indexOf("3.02") != -1));
  1423.  
  1424.  
  1425. function HasExtJs()
  1426. {
  1427.     if (s_bIE3Before) { return false;}
  1428.     if (s_bNS3Before) {    return false;}
  1429.     if (typeof (BsGeneralOnLoad) == "undefined"){ return false; }
  1430.     return true;
  1431. }
  1432.  
  1433.  
  1434. function BSSCCreatePopupDiv()
  1435. {
  1436.     if(HasExtJs())    {_BSSCCreatePopupDivOnWrite();}
  1437. }
  1438.  
  1439.  
  1440. function WritePopupMenuLayer()
  1441. {
  1442.     if (HasExtJs()) {_WritePopupMenuLayer();}
  1443. }
  1444.  
  1445. function BSSCPopup(strURL)
  1446. {
  1447.     if (HasExtJs())    { 
  1448.         _BSSCPopup(strURL);
  1449.     }else{
  1450.         //Create a temporary window first to ensure the real popup comes up on top
  1451.         var wndTemp = null;
  1452.         if (!s_bNS3) {
  1453.             wndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1454.         }
  1455.         // Create the real popup window
  1456.         var wndPopup = window.open(strURL, "BSSCPopup", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400");
  1457.         // Close the temporary
  1458.         if (!s_bNS3) {
  1459.             wndTemp.close();
  1460.         } else {
  1461.             wndPopup.focus();
  1462.         }
  1463.     }
  1464. }
  1465.  
  1466. var gbWndTemp = null, gbWndPopupLinks = null;
  1467. var gbstrParaTotal = "";
  1468.  
  1469. function PopupMenu_Invoke()
  1470. {
  1471.     if (HasExtJs()) {
  1472.         return _PopupMenu_Invoke(PopupMenu_Invoke.arguments);
  1473.     }
  1474.     if (s_bNS3Before || s_bIE3Before )    {
  1475.         var argLen     = PopupMenu_Invoke.arguments.length;
  1476.         if (argLen < 5) {
  1477.             window.document.location.href = PopupMenu_Invoke.arguments[3];
  1478.             return false;
  1479.         }
  1480.         gbWndTemp = null;
  1481.         gbWndPopupLinks = null;
  1482.         gbstrParatotal = "";
  1483.         for (var i = 0; i < (argLen - 2) / 2; i++) {
  1484.             var strParaLine = "";
  1485.             if (s_bNS2 || s_bOpera){
  1486.                 strParaLine += "<a href=\"";
  1487.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1488.                 strParaLine += "\">"
  1489.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1490.                 strParaLine += "</a>";
  1491.             } else {
  1492.                 strParaLine += "<a href=\"javascript:";
  1493.                 strParaLine += "gotoUrl(\'";
  1494.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 3];
  1495.                 strParaLine += "\');\"";
  1496.                 if (PopupMenu_Invoke.arguments[1] != '') {
  1497.                     strParaLine += " TARGET='" + PopupMenu_Invoke.arguments[1] + "'";
  1498.                 }
  1499.                 strParaLine += ">";
  1500.                 strParaLine += PopupMenu_Invoke.arguments[2 * i + 2];
  1501.                 strParaLine += "</a>";
  1502.             }
  1503.             strParaLine += "<br>";
  1504.             gbstrParaTotal += strParaLine;
  1505.         }
  1506.         var nHeight = argLen * 15;
  1507.         var nWidth = 400;
  1508.         var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=auto";
  1509.         strParam += ",height=" + nHeight + ",width=200,resizable";
  1510.         
  1511.         //Create a temporary window first to ensure the real popup comes up on top
  1512.         //var wndTemp = null;
  1513.         if (!s_bNS3) {
  1514.             gbWndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4");
  1515.         } 
  1516.         gbWndPopupLinks = window.open("", "popuplinks", strParam);
  1517.  
  1518.         setTimeout("Wait_PopupMenuReady()", 100);
  1519.     }
  1520.     return true;
  1521. }
  1522.  
  1523. function Wait_PopupMenuReady() 
  1524. {
  1525.     if (gbWndPopupLinks != null && "object" == typeof(gbWndPopupLinks.document)) {
  1526.         PopupMenu_InvokeReady();
  1527.     }
  1528.     else 
  1529.         setTimeout("Wait_PopupMenuReady()", 100);
  1530. }
  1531.  
  1532.  
  1533. function PopupMenu_InvokeReady()
  1534. {
  1535.     if (gbWndPopupLinks != null) {
  1536.         gbWndPopupLinks.document.open("text/html");
  1537.         gbWndPopupLinks.document.write("<html><head>");
  1538.         if (s_bNS2 || s_bOpera) {
  1539.             gbWndPopupLinks.document.write("<base href=\"" + location +"\">");
  1540.         } else {
  1541.             //YJ: IE301,302 and NS3.x works fine
  1542.             gbWndPopupLinks.document.write("<");
  1543.             gbWndPopupLinks.document.write("script>");
  1544.             gbWndPopupLinks.document.write("function gotoUrl(aUrl) {opener.window.location=aUrl; close();}");
  1545.             gbWndPopupLinks.document.write("<");
  1546.             gbWndPopupLinks.document.write("/script>");
  1547.         }
  1548.         gbWndPopupLinks.document.write("</head><body onBlur=\'self.focus();\'>");
  1549.         gbWndPopupLinks.document.write(gbstrParaTotal);
  1550.         gbWndPopupLinks.document.write("</body></html>");
  1551.         gbWndPopupLinks.document.close();
  1552.  
  1553.         // Close the temporary
  1554.         if (!s_bNS3 && gbWndTemp != null) {
  1555.             gbWndTemp.close();
  1556.         }else {
  1557.             gbWndPopupLinks.focus();
  1558.         }
  1559.  
  1560.         return true;
  1561.     }
  1562.     return false;
  1563. }
  1564.  
  1565. /// Section End - Embedded Stub (JavaScript 1.0)
  1566.  
  1567. //// Segment End -- (JavaScript 1.0)
  1568.  
  1569.  
  1570.